﻿using Microsoft.EntityFrameworkCore;
using NewRetail.Application.Components.Goods.Entity;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace NewRetail.Application.Components.Goods
{
    public interface IProductCategoryService : IApplicationService
    {
        Task<IEnumerable<GoodsCategory>> QueryAll();
    }

    public class ProductCategoryService : ApplicationService, IProductCategoryService
    {
        private readonly IRepository<GoodsCategory> goodsCategories;
        public ProductCategoryService(IRepository<GoodsCategory> goodsCategories)
        {
            this.goodsCategories = goodsCategories;
        }

        public async Task<IEnumerable<GoodsCategory>> QueryAll()
        {
            var data = await this.goodsCategories.Take(5000).ToListAsync();
            return data;
        }
    }
}
